//
//  OrderDetailCommonCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/9/11.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "OrderDetailCommonCell.h"

@implementation OrderDetailCommonCell


#pragma mark - lifecycle methods

- (void)setupUI{
    
    self.backgroundColor = KRedColor;
    
    [self addSubview:self.titleLab1];
    [self addSubview:self.titleLab2];
    [self addSubview:self.titleLab3];

    [self addSubview:self.detailLab1];
    [self addSubview:self.detailLab2];
    [self addSubview:self.detailLab3];

}

- (void)setupLayout{
    
    CGFloat width = (KScreenWidth - 30)/2.0;
    {
        _titleLab1.size = _titleLab2.size = _detailLab1.size = _detailLab2.size = CGSizeMake(width, 18);
        _titleLab1.mj_x = _titleLab2.mj_x = 15;
        _titleLab1.mj_y = 15;
        _titleLab2.mj_y = _titleLab1.bottom + 10;
        _titleLab3.size = _detailLab3.size = CGSizeMake(width, 38);
        _titleLab3.mj_x = 15;

        _titleLab3.mj_y = _detailLab3.mj_y = 76;
        
        _detailLab1.mj_x = _detailLab2.mj_x = (KScreenWidth - 30 )- width - 15;
        _detailLab1.mj_y = _titleLab1.mj_y;
        _detailLab2.mj_y = _titleLab2.mj_y;
        _detailLab3.mj_x = _detailLab1.mj_x;

    }
    
}



#pragma mark - setter methods

//- (void)setItem:(MeatPayOrderItem *)item{
//
//    __block float price = 0;
//    [item.meets enumerateObjectsUsingBlock:^(Meats * _Nonnull meats, NSUInteger idx, BOOL * _Nonnull stop) {
//        [meats.list enumerateObjectsUsingBlock:^(MeatsItem * _Nonnull obj, NSUInteger index, BOOL * _Nonnull stop) {
//            price += [obj.nowPrice floatValue];
//        }];
//    }];
//
//    _detailLab1.text = [NSString stringWithFormat:@"¥%.2f", price];
//}


#pragma mark - getter methods

- (UILabel *)titleLab1{
    
    if (!_titleLab1) {
        _titleLab1 = [UILabel makeLabelWithText:@"订单编号：" textColor:UIColorFromRGB(0x454545) font:mFont(13) textAliment:0];
    }
    return _titleLab1;
}

- (UILabel *)titleLab2{
    
    if (!_titleLab2) {
        _titleLab2 = [UILabel makeLabelWithText:@"下单时间：" textColor:UIColorFromRGB(0x454545) font:mFont(13) textAliment:0];
    }
    return _titleLab2;
}

- (UILabel *)titleLab3{
    
    if (!_titleLab3) {
        _titleLab3 = [UILabel makeLabelWithText:@"支付方式：" textColor:UIColorFromRGB(0x666666) font:mFont(13) textAliment:0];
        _titleLab3.hidden = YES;
    }
    return _titleLab3;
}


- (UILabel *)detailLab1{
    
    if (!_detailLab1) {
        _detailLab1 = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0xF25C62) font:mFont(12) textAliment:2];
    }
    return _detailLab1;
}

- (UILabel *)detailLab2{
    
    if (!_detailLab2) {
        _detailLab2 = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0xF25C62) font:mFont(12) textAliment:2];
    }
    return _detailLab2;
}

- (UILabel *)detailLab3{
    
    if (!_detailLab3) {
        _detailLab3 = [UILabel makeLabelWithText:@"微信支付" textColor:UIColorFromRGB(0xF25C62) font:mFont(12) textAliment:2];
    }
    return _detailLab3;
}

@end
